package com.wcj.demo.controller;

import com.wcj.demo.pojo.Medicine;
import com.wcj.demo.service.MedicineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@RestController
public class MedicineController {
    @Autowired
    MedicineService ms;

    @RequestMapping("/getMed")
    public ModelAndView getMedicine(ModelAndView mav){
        System.out.println("进入controller");
        List<Medicine> list=ms.findAllMed();
        mav.setViewName("test");
        mav.addObject("key",list);
        return mav;
    }

}
